package com.qf.news.controller;

import com.qf.news.entity.NewsType;
import com.qf.news.entity.R;
import com.qf.news.service.NewsTypeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 新闻分类(NewsType)表控制层 阿斯顿法师打发手打
 *
 * @author makejava
 * @since 2023-07-20 10:11:38
 */
@RestController
@RequestMapping("newsType")
@CrossOrigin
public class NewsTypeController {
    /**
     * 服务对象
     */
    @Autowired
    private NewsTypeService newsTypeService;

    /**
     * 查询分类列表
     * @return
     */
    @RequestMapping("/list")
    public R list(){
        return R.succ(newsTypeService.list());
    }

    /**
     * 新增分类
     * @return
     */
    @RequestMapping("/insert")
    public R insert(NewsType newsType){
        newsTypeService.save(newsType);
        return R.succ(null);
    }
}

